import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common';
import { AppController } from './test.controller';
import { AppService } from './test.service';
import { TypeOrmModule } from '@nestjs/typeorm';
import SysTest from '../../entities/test/sys-test.entity';
import { HashPasswordMiddleware } from 'src/middlewares/hash-password.middleware';
@Module({
  // 调用此方法在数据库中生成了映射类
  imports: [TypeOrmModule.forFeature([SysTest])],
  controllers: [AppController],
  providers: [AppService],
})
export class testModule implements NestModule {
  configure(consumer: MiddlewareConsumer) {
    consumer.apply(HashPasswordMiddleware).forRoutes('test'); //对应的是某个路由下才会生效 其他的路由就不会影响了
  }
}
